<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>大屏通用布局组件</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
  <style>
    :root {
      --primary-color: #1a73e8;
      --secondary-color: #0d47a1;
      --success-color: #4caf50;
      --warning-color: #ff9800;
      --danger-color: #f44336;
      --text-color: #333;
      --bg-color: #f5f7fa;
      --card-bg: #ffffff;
      --header-height: 60px;
      --footer-height: 40px;
      --sidebar-width: 250px;
      --border-radius: 8px;
      --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
      --transition: all 0.3s ease;
    }

    .dark-mode {
      --text-color: #f0f0f0;
      --bg-color: #1a1d21;
      --card-bg: #25282c;
      --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    }

    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      transition: var(--transition);
    }

    body {
      font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
      background-color: var(--bg-color);
      color: var(--text-color);
      line-height: 1.6;
      overflow-x: hidden;
      padding: 20px;
      min-height: 100vh;
    }

    .container {
      max-width: 1600px;
      margin: 0 auto;
    }

    header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 30px;
      padding-bottom: 15px;
      border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }

    .title {
      font-size: 2rem;
      font-weight: 700;
      color: var(--primary-color);
    }

    .controls {
      display: flex;
      gap: 15px;
    }

    .btn {
      padding: 8px 16px;
      border: none;
      border-radius: var(--border-radius);
      background-color: var(--primary-color);
      color: white;
      cursor: pointer;
      font-weight: 500;
      display: flex;
      align-items: center;
      gap: 5px;
    }

    .btn:hover {
      opacity: 0.9;
      transform: translateY(-2px);
    }

    .btn-outline {
      background: transparent;
      border: 1px solid var(--primary-color);
      color: var(--primary-color);
    }

    .btn-success {
      background-color: var(--success-color);
    }

    .btn-warning {
      background-color: var(--warning-color);
    }

    .btn-danger {
      background-color: var(--danger-color);
    }

    /* 大屏布局组件 */
    .screen-container {
      background: var(--card-bg);
      border-radius: var(--border-radius);
      box-shadow: var(--box-shadow);
      overflow: hidden;
      position: relative;
      height: 80vh;
      min-height: 600px;
      display: flex;
      flex-direction: column;
    }

    /* 顶部标题区域 */
    .screen-header {
      height: var(--header-height);
      background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
      color: white;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 20px;
      flex-shrink: 0;
    }

    .screen-title {
      font-size: 1.5rem;
      font-weight: 600;
    }

    .screen-time {
      font-size: 1.1rem;
      font-family: monospace;
    }

    /* 主内容区域 */
    .screen-body {
      flex: 1;
      display: flex;
      overflow: hidden;
      position: relative;
    }

    /* 侧边栏 */
    .screen-sidebar {
      width: var(--sidebar-width);
      background: var(--card-bg);
      border-right: 1px solid rgba(0, 0, 0, 0.1);
      padding: 20px;
      overflow-y: auto;
      flex-shrink: 0;
    }

    .sidebar-menu {
      list-style: none;
    }

    .sidebar-menu li {
      padding: 12px 15px;
      border-radius: var(--border-radius);
      margin-bottom: 5px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .sidebar-menu li:hover,
    .sidebar-menu li.active {
      background: rgba(26, 115, 232, 0.1);
      color: var(--primary-color);
    }

    /* 主内容区 */
    .screen-main {
      flex: 1;
      padding: 20px;
      overflow: auto;
      position: relative;
    }

    /* 九宫格布局 */
    .grid-layout {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      grid-template-rows: repeat(3, 1fr);
      gap: 20px;
      height: 100%;
    }

    .grid-item {
      background: rgba(26, 115, 232, 0.05);
      border-radius: var(--border-radius);
      border: 1px solid rgba(26, 115, 232, 0.1);
      padding: 15px;
      display: flex;
      flex-direction: column;
    }

    .grid-item-header {
      font-weight: 600;
      margin-bottom: 10px;
      color: var(--primary-color);
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .grid-item-content {
      flex: 1;
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 1.5rem;
    }

    /* 底部信息 */
    .screen-footer {
      height: var(--footer-height);
      background: rgba(0, 0, 0, 0.03);
      border-top: 1px solid rgba(0, 0, 0, 0.05);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 20px;
      font-size: 0.9rem;
      color: #666;
      flex-shrink: 0;
    }

    /* 布局选择器 */
    .layout-selector {
      display: flex;
      gap: 15px;
      margin: 20px 0;
    }

    .layout-option {
      width: 100px;
      height: 80px;
      background: var(--card-bg);
      border-radius: var(--border-radius);
      cursor: pointer;
      border: 2px solid transparent;
      overflow: hidden;
      position: relative;
      box-shadow: var(--box-shadow);
    }

    .layout-option.active {
      border-color: var(--primary-color);
    }

    .layout-preview {
      width: 100%;
      height: 100%;
      display: flex;
      flex-direction: column;
    }

    .preview-header {
      height: 15%;
      background: var(--primary-color);
    }

    .preview-body {
      flex: 1;
      display: flex;
    }

    .preview-sidebar {
      width: 25%;
      background: rgba(26, 115, 232, 0.3);
    }

    .preview-main {
      flex: 1;
      background: rgba(26, 115, 232, 0.1);
    }

    .preview-footer {
      height: 10%;
      background: rgba(26, 115, 232, 0.2);
    }

    /* 图表占位 */
    .chart-placeholder {
      width: 100%;
      height: 100%;
      background: linear-gradient(45deg, rgba(26, 115, 232, 0.05) 25%, transparent 25%,
          transparent 50%, rgba(26, 115, 232, 0.05) 50%,
          rgba(26, 115, 232, 0.05) 75%, transparent 75%, transparent);
      background-size: 20px 20px;
      border-radius: var(--border-radius);
      display: flex;
      justify-content: center;
      align-items: center;
      color: #999;
      font-style: italic;
    }

    /* 响应式处理 */
    @media (max-width: 1200px) {
      .grid-layout {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(4, 1fr);
      }
    }

    @media (max-width: 768px) {
      .grid-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
      }

      .screen-body {
        flex-direction: column;
      }

      .screen-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        height: auto;
        max-height: 200px;
      }
    }

    /* 动画效果 */
    @keyframes fadeIn {
      from {
        opacity: 0;
        transform: translateY(10px);
      }

      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    .fade-in {
      animation: fadeIn 0.5s ease forwards;
    }

    .delay-1 {
      animation-delay: 0.1s;
    }

    .delay-2 {
      animation-delay: 0.2s;
    }

    .delay-3 {
      animation-delay: 0.3s;
    }
  </style>
</head>

<body>
  <div class="container">
    <header>
      <div class="title">大屏通用布局组件</div>
      <div class="controls">
        <button class="btn" id="exportBtn">
          <i class="fas fa-download"></i> 导出配置
        </button>
        <button class="btn btn-outline" id="themeToggle">
          <i class="fas fa-moon"></i> 深色模式
        </button>
        <button class="btn btn-warning" id="resetBtn">
          <i class="fas fa-redo"></i> 重置布局
        </button>
      </div>
    </header>

    <div class="layout-selector">
      <div class="layout-option active" data-layout="top-bottom">
        <div class="layout-preview">
          <div class="preview-header"></div>
          <div class="preview-body">
            <div class="preview-main"></div>
          </div>
          <div class="preview-footer"></div>
        </div>
      </div>
      <div class="layout-option" data-layout="left-right">
        <div class="layout-preview">
          <div class="preview-body">
            <div class="preview-sidebar"></div>
            <div class="preview-main"></div>
          </div>
        </div>
      </div>
      <div class="layout-option" data-layout="mixed">
        <div class="layout-preview">
          <div class="preview-header"></div>
          <div class="preview-body">
            <div class="preview-sidebar"></div>
            <div class="preview-main"></div>
          </div>
          <div class="preview-footer"></div>
        </div>
      </div>
      <div class="layout-option" data-layout="grid">
        <div class="layout-preview">
          <div class="preview-body">
            <div class="preview-main"
              style="display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 2px; padding: 2px;">
              <div style="background: rgba(26, 115, 232, 0.3);"></div>
              <div style="background: rgba(26, 115, 232, 0.3);"></div>
              <div style="background: rgba(26, 115, 232, 0.3);"></div>
              <div style="background: rgba(26, 115, 232, 0.3);"></div>
              <div style="background: rgba(26, 115, 232, 0.3);"></div>
              <div style="background: rgba(26, 115, 232, 0.3);"></div>
              <div style="background: rgba(26, 115, 232, 0.3);"></div>
              <div style="background: rgba(26, 115, 232, 0.3);"></div>
              <div style="background: rgba(26, 115, 232, 0.3);"></div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <div class="screen-container">
      <div class="screen-header">
        <div class="screen-title">数据中心监控平台</div>
        <div class="screen-time" id="currentTime">2023-11-15 14:30:45</div>
      </div>

      <div class="screen-body">
        <div class="screen-sidebar">
          <ul class="sidebar-menu">
            <li class="active"><i class="fas fa-chart-line"></i> 数据概览</li>
            <li><i class="fas fa-server"></i> 服务器监控</li>
            <li><i class="fas fa-network-wired"></i> 网络状态</li>
            <li><i class="fas fa-database"></i> 数据库监控</li>
            <li><i class="fas fa-exclamation-triangle"></i> 告警中心</li>
            <li><i class="fas fa-cog"></i> 系统设置</li>
          </ul>
        </div>

        <div class="screen-main">
          <div class="grid-layout">
            <div class="grid-item fade-in">
              <div class="grid-item-header">
                <span>CPU使用率</span>
                <i class="fas fa-microchip"></i>
              </div>
              <div class="grid-item-content">
                <div class="chart-placeholder">CPU使用率图表</div>
              </div>
            </div>

            <div class="grid-item fade-in delay-1">
              <div class="grid-item-header">
                <span>内存使用</span>
                <i class="fas fa-memory"></i>
              </div>
              <div class="grid-item-content">
                <div class="chart-placeholder">内存使用图表</div>
              </div>
            </div>

            <div class="grid-item fade-in delay-2">
              <div class="grid-item-header">
                <span>网络流量</span>
                <i class="fas fa-wifi"></i>
              </div>
              <div class="grid-item-content">
                <div class="chart-placeholder">网络流量图表</div>
              </div>
            </div>

            <div class="grid-item fade-in delay-1">
              <div class="grid-item-header">
                <span>磁盘I/O</span>
                <i class="fas fa-hdd"></i>
              </div>
              <div class="grid-item-content">
                <div class="chart-placeholder">磁盘I/O图表</div>
              </div>
            </div>

            <div class="grid-item fade-in delay-2">
              <div class="grid-item-header">
                <span>服务状态</span>
                <i class="fas fa-cubes"></i>
              </div>
              <div class="grid-item-content">
                <div class="chart-placeholder">服务状态图表</div>
              </div>
            </div>

            <div class="grid-item fade-in delay-3">
              <div class="grid-item-header">
                <span>实时告警</span>
                <i class="fas fa-bell"></i>
              </div>
              <div class="grid-item-content">
                <div class="chart-placeholder">实时告警列表</div>
              </div>
            </div>

            <div class="grid-item fade-in delay-2">
              <div class="grid-item-header">
                <span>API响应时间</span>
                <i class="fas fa-stopwatch"></i>
              </div>
              <div class="grid-item-content">
                <div class="chart-placeholder">API响应图表</div>
              </div>
            </div>

            <div class="grid-item fade-in delay-3">
              <div class="grid-item-header">
                <span>用户访问量</span>
                <i class="fas fa-users"></i>
              </div>
              <div class="grid-item-content">
                <div class="chart-placeholder">用户访问图表</div>
              </div>
            </div>

            <div class="grid-item fade-in delay-3">
              <div class="grid-item-header">
                <span>数据库查询</span>
                <i class="fas fa-search"></i>
              </div>
              <div class="grid-item-content">
                <div class="chart-placeholder">数据库查询图表</div>
              </div>
            </div>
          </div>
        </div>
      </div>

      <div class="screen-footer">
        <div>© 2023 数据中心监控平台 v2.5</div>
        <div>最后更新: 2023-11-15 14:25:03 | 数据刷新间隔: 10秒</div>
      </div>
    </div>
  </div>

  <script>
    // 更新当前时间
    function updateTime() {
      const now = new Date();
      const timeString = now.toLocaleString('zh-CN', {
        year: 'numeric',
        month: '2-digit',
        day: '2-digit',
        hour: '2-digit',
        minute: '2-digit',
        second: '2-digit',
        hour12: false
      }).replace(/\//g, '-');

      document.getElementById('currentTime').textContent = timeString;
    }

    // 初始化时间
    updateTime();
    setInterval(updateTime, 1000);

    // 深色模式切换
    const themeToggle = document.getElementById('themeToggle');
    themeToggle.addEventListener('click', () => {
      document.body.classList.toggle('dark-mode');
      const icon = themeToggle.querySelector('i');
      if (document.body.classList.contains('dark-mode')) {
        icon.classList.remove('fa-moon');
        icon.classList.add('fa-sun');
        themeToggle.innerHTML = '<i class="fas fa-sun"></i> 浅色模式';
      } else {
        icon.classList.remove('fa-sun');
        icon.classList.add('fa-moon');
        themeToggle.innerHTML = '<i class="fas fa-moon"></i> 深色模式';
      }
    });

    // 布局切换
    const layoutOptions = document.querySelectorAll('.layout-option');
    layoutOptions.forEach(option => {
      option.addEventListener('click', () => {
        layoutOptions.forEach(opt => opt.classList.remove('active'));
        option.classList.add('active');
        // 在实际应用中，这里会切换不同的布局结构
        alert(`切换到 ${option.dataset.layout} 布局`);
      });
    });

    // 重置布局
    document.getElementById('resetBtn').addEventListener('click', () => {
      if (confirm('确定要重置布局为默认设置吗？')) {
        layoutOptions[0].click();
        alert('布局已重置');
      }
    });

    // 导出配置
    document.getElementById('exportBtn').addEventListener('click', () => {
      alert('布局配置已导出');
    });

    // 菜单项点击事件
    const menuItems = document.querySelectorAll('.sidebar-menu li');
    menuItems.forEach(item => {
      item.addEventListener('click', () => {
        menuItems.forEach(i => i.classList.remove('active'));
        item.classList.add('active');
      });
    });
  </script>
</body>

</html>